package com.shiguiwu.springmybatis.spring.autowired;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.ComponentScan;

/**
 * @description: 配置类
 * @author: stone
 * @date: Created by 2021/3/15 14:43
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.spring.autowired
 */
@ComponentScan
@Data
public class AConfig {

    //当有多个bean的时候，spring为我们选择属性名称为首选bean
    @Autowired
    private C b;

    //当有多个bean的时候，spring为我们选择属性名称为首选bean
    @Autowired
    private C a;

    //报错，需要加上权重注解Primary,Qualifier
    @Autowired
    @Qualifier(value = "a")
    private C c;

}
